# Variables
CC = gcc
CFLAGS = -Wall -Wextra -std=c11
SRC_DIR = src
OBJ_DIR = obj
BIN_DIR = bin
TARGET = stellaris_test

# Source and object files
SRC = $(SRC_DIR)/stellaris_test.c
OBJ = $(OBJ_DIR)/stellaris_test.o

# Default target
all: $(BIN_DIR)/$(TARGET)

# Compile the source file into an object file
$(OBJ): $(SRC)
	mkdir -p $(OBJ_DIR)
	$(CC) $(CFLAGS) -c $< -o $@

# Link the object file into the final executable
$(BIN_DIR)/$(TARGET): $(OBJ)
	mkdir -p $(BIN_DIR)
	$(CC) $(CFLAGS) $< -o $@

# Clean up generated files
clean:
	rm -rf $(OBJ_DIR) $(BIN_DIR)

.PHONY: all clean